package com.lz.specification.reference;

import java.lang.ref.SoftReference;
import java.util.ArrayList;
import java.util.List;

/**
 * SoftReferenceHouse 软引用
 *
 * 运行参数：－Xms20m -Xmx20m
 *
 * @author: li
 * @date: 2019/1/14
 */
public class SoftReferenceHouse {
    /**
     *
     * @param args  －Xms20m -Xmx20m
     */
    public static void main(String[] args) {
        List<SoftReference> houses = new ArrayList<SoftReference>();
        int i = 0;
        while (true) {
            SoftReference<House> buyer2 = new SoftReference<>(new House());
            houses.add(buyer2);
            System.out.println("i=" + (++i));
        }

    }
}

class House {
    private static final Integer DOORNUMBER = 2000;
    public Door[] doors = new Door[DOORNUMBER];
}

class Door {
}